package xyz.kail.demo;

import org.aopalliance.intercept.MethodInterceptor;
import org.aopalliance.intercept.MethodInvocation;
import org.springframework.aop.MethodBeforeAdvice;

import java.lang.reflect.Method;

public class HelloAdvice implements MethodBeforeAdvice {
    @Override
    public void before(Method method, Object[] args, Object target) throws Throwable {
        System.out.println("adsd");
    }


//    @Override
//    public Object invoke(MethodInvocation invocation) throws Throwable {
//        Object result;
//        try {
//            System.out.println("开始事务");
//            result =invocation.proceed();
//            System.out.println("提交事务");
//        } catch (Throwable ex) {
//            System.out.println("回滚事务");
//            throw ex;
//        } finally {
//            System.out.println("释放资源");
//        }
//        return result;
//    }


}
